home *** CD-ROM | disk | FTP | other *** search
- package com.ms.dxmedia;
-
- public class DXMCanvas extends DXMCanvasBase implements Runnable {
- private Thread _thread;
- private boolean _showing = true;
-
- public synchronized void removeModel() {
- if (this._thread != null) {
- this._thread.stop();
-
- try {
- this._thread.join();
- } catch (InterruptedException var1) {
- }
-
- this._thread = null;
- ((DXMCanvasBase)this).stopModel();
- }
-
- }
-
- public synchronized void hideModel() {
- if (this._showing && this._thread != null) {
- this._thread.suspend();
- this._showing = false;
- }
-
- }
-
- public synchronized void addModel() {
- if (this._thread == null) {
- try {
- ((DXMCanvasBase)this).startModel();
- } catch (DXMException var3) {
- ((DXMCanvasBase)this).stopModel();
- throw var3;
- }
-
- this._thread = new Thread(this);
- if (!this._showing) {
- this._thread.suspend();
- }
-
- this._thread.start();
- }
-
- }
-
- public void run() {
- Thread.currentThread().setPriority(1);
-
- while(true) {
- try {
- ((DXMCanvasBase)this).tick();
-
- try {
- Thread.sleep(0L);
- } catch (InterruptedException var1) {
- }
- } catch (DXMException var2) {
- this.removeModel();
- return;
- }
- }
- }
-
- protected Thread GetThread() {
- return this._thread;
- }
-
- public synchronized void showModel() {
- if (!this._showing && this._thread != null) {
- this._thread.resume();
- this._showing = true;
- }
-
- }
- }
-